205A - Little Elephant and Rozdil - CodeForces Solution


brute force implementation *900

Please click on ads to support us..

Python Code:

n=int(input())
l=list(map(int, input().split()))
min=l[0]
i_min=0
i=1
while(i<n):
    if(min>l[i]):
        min=l[i]
        i_min=i
    i=i+1
if(l.count(min)==1):
    print(i_min+1)
else:
    print("Still Rozdil")

C++ Code:

#include<iostream>
#include<string.h>

using namespace std;

int main(){
    int n;
    cin>>n;
    int a[n];
    cin>>a[0];
    int  min=a[0];
    int min_i=0,count=0;
    for (int i = 1; i < n; i++)
    {
        cin>>a[i];
        if (min>a[i])
        {
            min=a[i];
            min_i=i;
        }
    }
    for (int  i = 0; i < n; i++)
    {
        if (min==a[i])
        {
            count++;
        }
    }
    if (count>1)
    {
        cout<<"Still Rozdil";
    }
    else{
        cout<<min_i+1;
    }
    
    
return 0;
}


Comments

Submit
0 Comments
More Questions

Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup
Ali and Helping innocent people
Book of Potion making
Duration
Birthday Party
e-maze-in
Bricks Game
Char Sum
Two Strings
Anagrams
Prime Number
Lexical Sorting Reloaded
1514A - Perfectly Imperfect Array
580A- Kefa and First Steps
1472B- Fair Division
996A - Hit the Lottery
MSNSADM1 Football
MATCHES Playing with Matches
HRDSEQ Hard Sequence
DRCHEF Doctor Chef
559. Maximum Depth of N-ary Tree
821. Shortest Distance to a Character
1441. Build an Array With Stack Operations
1356. Sort Integers by The Number of 1 Bits